<!DOCTYPE HTML>
<html>
<head>
    <meta http-equiv='Content-Type' content='text/html; charset=utf-8'>
    <meta name='viewport' content='width=device-width, initial-scale=1'>
    <title>Wedding Gifts 101 - A Bridal Registry Website</title>
    <style>
        *, html{
            margin: 0;
            padding: 0;
        }
        #wrapper{
            width: 100%;
            height: 100%;
            position: absolute;
            top: 0;
            left: 0;
            text-align: center;
            margin: auto;
            z-index: 50;
            overflow: hidden;
			background-image: url(images/under_contruction.jpg);
			display: none;
        }
        h1, h2{
            font: bolder 28px/30px 'Trebuchet MS', Arial, Helvetica, sans-serif;
            text-shadow: 1px 1px #fff;
            padding: 1em;
        }
        h2{
            font-size: 22px;
            margin: 0.1em;	
        }
        .img{
            width: 100%;
            position: absolute;
            top: 0;
            left: 0;
            z-index: -50;	
        }
        input[type=email]{
            width: 350px;
            padding: 0.3em;
            text-align: center;
            margin: 1em auto;
            border: 1px solid #fff;
            border-bottom: 2px solid #000;	
        }
        input[type=button]{
			background: #666;
			border-radius: 7px;
			padding: 3px;
			color: #fff;
        }
		#confirm{
			margin-top: 1em;
			font-size: 16px;
			font-weight: bolder;
			text-shadow: 1px 1px #fff;
			color: #060;
		}
    </style>
    <script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
    <script type='text/javascript'>
        window.onload = init;
        function init(){
            var wrapper = document.getElementById('wrapper');
            var input = document.getElementsByTagName('INPUT')[0];
            var register = document.getElementsByTagName('INPUT')[1];
			var confirmation = document.getElementById('confirm');
			var bgpl = document.getElementById('bg-pre-loader');
            var bg = function(){
                var fx = document.createElement('IMG');
                fx.src = 'images/under_contruction.jpg';
                fx.setAttribute('class', 'img');
                wrapper.appendChild(fx);
				wrapper.style.background = 'none';
				wrapper.style.display = 'block';
            };
            var resizer = function(){
                var width = wrapper.offsetWidth;	
            };
            var noSubmit = function(evt){
                var register = document.getElementsByTagName('INPUT')[1];
				if(evt.keyCode == 13){
                    register.click() = sendInfo;
                    return false;	
                }
            };
			var data = function(){
				var ePattern = /^[\w-]+(?:\.[\w-]+)*@(?:[\w-]+\.)+[a-zA-Z]{2,7}$/i;
				var matched = ePattern.test(input.value);
				if(!matched){
					input.style.borderBottomColor = '#F00F00';
					return false;
				}
				else 
					return input.value;
			};
            var sendInfo = function(){
				var email = data();
				if(!email)
					return false;
				$.post('registration.php', {email: email}).done(function(res){
					input.style.display = 'none';
					register.style.display = 'none';
					confirmation.innerHTML = res;
				}); 
            };
            window.onresize = resizer;
            register.onclick = sendInfo;
            input.onkeypress = noSubmit;
            return bg();
        }
    </script>
</head>

<body>
	<div id='wrapper'>
    	<h1>WeddingGifts101 is coming Soon!!!</h1>
        <h2>Stand-by &#9786; and we'll let you know</h2>
		<input type='email' name='email' autofocus='autofocus' placeholder='Enter your email here' />
        <div><input type='button' id='register' value='register' /></div>
        <div id='confirm'></div>
    </div>
</body>
</html>
